package com.cxs.xiaomi.service.impl;

import com.cxs.xiaomi.dao.GoodsDao;
import com.cxs.xiaomi.dao.OrderDetailDao;
import com.cxs.xiaomi.dao.impl.GoodsDaoImpl;
import com.cxs.xiaomi.dao.impl.OrderDetailDaoImpl;
import com.cxs.xiaomi.domain.OrderDetail;
import com.cxs.xiaomi.service.OrderDetailService;
import com.sun.org.apache.xpath.internal.operations.Or;

import java.util.List;

/*
 * @Author:cxs
 * @Date:2021/9/17  11:28
 * @Version 1.0
 * @Motto:放下杂念,只为迎接明天更好的自己
 * */
public class OrderDetailServiceImpl implements OrderDetailService {
    private OrderDetailDao orderDetailDao = new OrderDetailDaoImpl();
    private GoodsDao goodsDao = new GoodsDaoImpl();

    @Override
    public List<OrderDetail> getList(String oid) {
        List<OrderDetail> orderDetailList = orderDetailDao.selectByOid(oid);
        for (OrderDetail orderDetail : orderDetailList) {
            orderDetail.setGoods(goodsDao.selectById(orderDetail.getPid()));
        }
        return orderDetailList;
    }
}
